<template>
  <div>
    <el-form-item label="" prop="projectDataSource" style="margin-bottom: 10px">
      <el-radio-group
        v-model="itemForm.projectDataSource"
        @input="changeProjectDataSource"
      >
        <el-radio
          v-for="dict in dict.type.salary_project_data"
          :key="dict.value"
          :label="dict.value"
          >{{ dict.label }}</el-radio
        >
      </el-radio-group>
    </el-form-item>
    <el-form-item
      label=""
      prop="projectDataSourceValue"
      v-if="itemForm.projectDataSource == 1"
    >
      <el-input
        v-model="itemForm.projectDataSourceValue"
        type="textarea"
        :placeholder="$t('please_enter', { name: $t('content') })"
      />
    </el-form-item>
    <el-form-item
      label=""
      prop="projectDataSourceValue"
      v-if="itemForm.projectDataSource == 2"
    >
      <el-radio-group v-model="itemForm.projectDataSourceValue">
        <el-radio label="考勤数据的出勤天数" class="radio-class">{{
          $t("attendance_ays")
        }}</el-radio>
        <el-radio label="考勤数据的迟到天数" class="radio-class">{{
          $t("days_late")
        }}</el-radio>
        <el-radio label="考勤数据的请假天数" class="radio-class">{{
          $t("leave_days")
        }}</el-radio>
        <el-radio label="考勤数据的年假天数" class="radio-class">{{
          $t("annual_leave_days")
        }}</el-radio>
        <el-radio label="假期数据的假期天数" class="radio-class">{{
          $t("holiday_days")
        }}</el-radio>
        <el-radio label="假期数据的年假天数" class="radio-class">{{
          $t("holiday_annual_leave_days")
        }}</el-radio>
        <el-radio label="固定薪资" class="radio-class">{{
          $t("fixed_salary")
        }}</el-radio>
        <el-radio label="临时薪资" class="radio-class">{{
          $t("temporary_compensation")
        }}</el-radio>
      </el-radio-group>
    </el-form-item>
  </div>
</template>

<script>
export default {
  props: {
    itemForm: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  dicts: ["salary_project_data"],
  data() {
    return {};
  },
  methods: {
    // 修改数据来源
    changeProjectDataSource() {
      this.$emit("update:itemForm", {
        ...this.itemForm,
        projectDataSourceValue: null,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.radio-class {
  margin-bottom: 16px;
}
</style>
